feat(wsgi,asgi): Introduce substitute values for filtered fields in span-streaming mode#6178
Conversation
…pan-streaming mode
When span streaming is enabled, sensitive headers are replaced with a
human-readable string ("[Filtered]") rather than an AnnotatedValue wrapper,
which is incompatible with the span-first data model.
Add substitute string constants (OVER_SIZE_LIMIT_SUBSTITUTE,
UNPARSABLE_RAW_DATA_SUBSTITUTE) and new AnnotatedValue factory methods
(substituted_because_raw_data, substituted_because_over_size_limit) that use
remark type "s" (substituted) instead of "x" (removed).
Update _filter_headers to auto-detect span streaming and choose the
appropriate value type, removing the use_annotated_value parameter.
Refs GH-2396
Fixes PY-2396
|
bugbot run |
|
@sentry review |
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 8.94s All tests are passing successfully. ❌ Patch coverage is 60.00%. Project has 14955 uncovered lines. Files with missing lines (3)
Generated by Codecov Action |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f696766. Configure here.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0ece900. Configure here.
…AnnotatedValue methods
sentrivana
left a comment
There was a problem hiding this comment.
Left one more comment re: the substitute value, otherwise lgtm!

In the legacy (event-based) pipeline, filtered/removed values in request data are represented as
AnnotatedValueobjects — wrappers that carry metadata (remremarks) consumed by Relay during ingestion. In span-streaming mode, request attributes are plain strings sent directly on spans, soAnnotatedValueis not appropriate there.Previously,
_filter_headershad ause_annotated_value: boolparameter that callers set toFalsewhen building span attributes. This was fragile — callers had to know the right value, and the logic was split between call sites instead of living in one place.This PR:
OVER_SIZE_LIMIT_SUBSTITUTE,UNPARSABLE_RAW_DATA_SUBSTITUTE) for use in the span-streaming path.AnnotatedValuefactory methods (substituted_because_raw_data,substituted_because_over_size_limit) that use remark type"s"(substituted) rather than"x"(removed), for future use as the SDK fully transitions to span-first.Refs GH-6175
Fixes PY-2396